package com.example.secutity.springmvc.init;

import com.example.secutity.springmvc.config.ApplicationConfig;
import com.example.secutity.springmvc.config.WebConfig;
import com.example.secutity.springmvc.config.WebSecurityConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * SpringApplicationInitializer相当于web.xml，使用了servlet3.0开发则不需要再定义web.xml
 *
 * @author yingyuwei
 * @version 1.0.0
 * @description web.xml
 * @createTime 2021年02月26日 20:53:00
 */
public class SpringApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{ApplicationConfig.class, WebSecurityConfig.class};    //指定rootContext的配置类
    }


    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{WebConfig.class};    //指定servletContext的配置类
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
